package com.jlpay.openapi.demo.trans.common;

import com.jlpay.open.jlpay.sdk.java.model.trans.common.request.CancelRequest;
import com.jlpay.open.jlpay.sdk.java.model.trans.common.response.CancelResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 接口好像有问题啊
 * @author dengwenning
 * @since 2024/9/23
 **/
public class CancelService {
    private static final Logger LOGGER = LoggerFactory.getLogger(CancelService.class);

    public static void main(String[] args) {
        CancelRequest cancelRequest = buildCancelRequest();
        CancelResponse cancelResponse = JlpayOpenApiService.openMerchService()
                .post(cancelRequest, CancelResponse.class);
        LOGGER.info("订单关闭响应:{}", JsonUtils.toString(cancelResponse));
    }

    private static CancelRequest buildCancelRequest() {
        CancelRequest cancelRequest = new CancelRequest();

        cancelRequest.setMchId("849584358120018");
        cancelRequest.setOutTradeNo("ld201911023465529");
        cancelRequest.setOriOutTradeNo("ld2019102216465525");
        cancelRequest.setOriTransactionId("80011557201909171853011568");
        cancelRequest.setTotalFee("1");
        cancelRequest.setRemark("该订单物流请走顺丰快递");
        cancelRequest.setMchCreateIp("123.12.12.123");
        cancelRequest.setLongitude("116.078631");
        cancelRequest.setLatitude("39.71274");

        return cancelRequest;
    }
}
